using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;


namespace AndroidUsersystemService.Controllers
{
    [Produces("application/json")]
    [Route("api/Login")]
    public class LoginController : Controller
    {
        [HttpGet]
        public JObject Get(string account, string password)
        {
            JObject JResult = new JObject();
            string msg;
            UserSystem.Model.UserInfoToClient client = UserSystem.BLL.LoginManage.Login(account, password, out msg);
            if (client == null)
            {
                JResult.Add("data", "");
                JResult.Add("msg", msg);
            }
            else
            {
                JObject jData = new JObject();
                jData.Add("userName", client.userName);
                jData.Add("token", client.token);
                JResult.Add("data", jData);
                JResult.Add("msg", msg);
            }
            return JResult;
        }
    }
}